package controllers

import (
	"map/models"
	"github.com/astaxie/beego/orm"
)

type StaffController struct{
	BaseController
}


func (this *StaffController)Create(){
	staff:=models.Staff{}
	if err:=this.ParseForm(&staff);err!=nil{
		this.errors("请检查输入格式",1)
	}
	b,msg:=staff.Valid()
	if !b {
		this.errors(msg,1)
	}

	_,err:=orm.NewOrm().Insert(&staff)
	if err!=nil{
		this.errors("添加失败",1)
	}
	this.success("")
}